home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c,comp.lang.c++
- Subject: Re: Why is C faster than FORTRAN?
- Date: 13 Mar 1996 10:36:07 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4i74inINNnfj@keats.ugrad.cs.ubc.ca>
- References: <4hv2ho$d8t@news.interpath.net> <4i2c5e$t70@kiwi.futuris.net> <4i4poj$j7e@thorn.cc.usm.edu>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <4i4poj$j7e@thorn.cc.usm.edu>,
- Peter Sakalaukus <sakalauk@coam.usm.edu> wrote:
- >I have two programs, FORTRAN and C. They both use the same algorithm to
- >manipulate numeric data. The larger the data file though, the faster the
- >C version is, (in relation to the FORTARN program). I am running on a UNIX
- >platform.
-
- If it is truly the same algorithm, and the C implementation is faster, than
- there will simply be a constant-factor difference in the running times, which
- makes one appear faster as the data set grows. If you find the ratio of their
- running times, you may discover that it is roughly constant.
-
- >My question is: what is the reason that C is so much quicker? Is C normally
- >faster than FORTRAN?
-
- The C compiler probably has better optimization, since it is the primary
- development language on the workstation you are using. It's hard to say without
- seeing both programs to see how they use the language features.
-
- You said that they work on a data file, which indicates that the C buffered I/O
- library may be responsible for the difference. Have you measured the
- user/system CPU times or just the elapsed wall clock time?
- --
-
-